package com.jlcindia;

public class OopsTest43 {

	public static void main(String[] args) {
		superA aref=new superA();
		aref.show();
		superA aref1=new subB();
		aref1.show();
		System.out.println("===========");
		superA aref2=new superA();
		aref2.process();
		superA aref3=new subB();
		aref3.process();//compiler will replace aref3 with the classname
		superA.process();
		System.out.println();
		//want to call member of class subB
		if(aref instanceof superA){
		subB bref=(subB)aref3;
		bref.process();//compiler will replace bref with the classname
		subB.process();
		}
		superA aref4=new subC();
		subC cref=(subC)aref4;
		cref.execute();
		superA aref5=new subC();
		subC cref1=(subC)aref5;
		cref1.showData();//because signature of showData() is undefined in supeA
		
		
		

	}
}
class superA{
	void show(){
		System.out.println("**show() from superA**");
	}
	static void process(){
		System.out.println("**process() from superA**");
	}	
}
class subB extends superA{
	void show(){
		System.out.println("**show() from subB**");
	}
	static void process(){  //method hiding
		System.out.println("**process() from subB**");
	}	
}
class subC extends superA{
	static void execute(){
		System.out.println("**execute() of subC**");
	}
	void showData(){
		System.out.println("**showData() of subC**");
	}
}
